<template>
    <!-- 买车列表 -->
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
            label-width="68px">
            <el-form-item label="品牌" prop="brand">
                <el-input v-model="queryParams.brand" placeholder="请输入" clearable></el-input>
            </el-form-item>
            <el-form-item label="开始时间" prop="startTime">
                <el-date-picker clearable v-model="queryParams.startTime" type="date" value-format="yyyy-MM-dd"
                    placeholder="请选择创建时间">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="结束时间" prop="endTime">
                <el-date-picker clearable v-model="queryParams.endTime" type="date" value-format="yyyy-MM-dd"
                    placeholder="请选择结束时间">
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <el-table v-loading="loading" :data="tagList">
            <el-table-column label="车辆名称" align="center" prop="brand" />
            <el-table-column label="颜色" align="center">
                <template slot-scope="{row}">
                    <div>{{ row.colour }}</div>
                </template>
            </el-table-column>
            <el-table-column label="价格（万元）" align="center">
                <template slot-scope="{row}">
                    <div>{{ row.guidePrice }}</div>
                </template>
            </el-table-column>
            <el-table-column label="联系方式" align="center" prop="vehicleType">
                <template slot-scope="{row}">
                    <div>{{ row.phone }}</div>

                </template>
            </el-table-column>
            <el-table-column label="任务状态" align="center">
                <template slot-scope="{row}">
                    <div>{{ row.statusName }}</div>
                </template>
            </el-table-column>
            <el-table-column label="寻车有效期" align="center">
                <template slot-scope="{row}">
                    <div>{{ row.lockForTime }}</div>
                </template>
            </el-table-column>



            <el-table-column label="发布时间" align="center">
                <template slot-scope="{row}">
                    <div>{{ row.createTime }}</div>
                </template>
            </el-table-column>

            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="{row}">
                    <!-- <el-button size="mini" type="text" @click="edit(row)">{{
                        row.status == 1 ? '下架' : '上架' }}</el-button> -->

                    <el-button size="mini" type="text" @click="views(row)">查看日志</el-button>
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getList" />

        <child-component ref="logRef"></child-component>
    </div>
</template>

<script>
import Enmu from "@/utils/enmu";
import { findCarList, getQuoteList, getLogList } from "@/api/crm/transport";

import { getAdminSellBuyPage, below, up } from "@/api/crm/car";

import { forrmatterEnmu } from "@/utils/index"
import { mapGetters } from "vuex"
import ProviceSelect from "@/components/ProviceSelect/index.vue"
import ChildComponent from "./components/log.vue"
import { timestampToDate } from '@/utils/index'
export default {
    components: {
        ChildComponent,
        ProviceSelect
    },
    name: "Tag",
    data() {
        return {
            provinces: [],
            cityslist: [],
            queryCitys: [],
            queryRegions: [],
            queryCitysAim: [],
            queryRegionsAim: [],
            Enmu,
            // 遮罩层
            loading: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 标签管理表格数据
            tagList: [],
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 20
            },
            // 报价列表
            quotationList: [],
            baseInfo: {},
            // 联系列表
            linkList: [],
            quotationPageInfo: {
                total: 0,
                pageSize: 10,
                pageNum: 1
            },
            linkPageInfo: {
                total: 0,
                pageSize: 10,
                pageNum: 1
            }
        };
    },
    created() {
        this.getList();
    },
    filters: {
        forrmatterTime(time) {
            if (!time || time == '') return "";
            return timestampToDate(time, 'ymdhm');
        }
    },
    computed: {
        ...mapGetters(['allCityList'])
    },
    methods: {

        /** 查询标签管理列表 */
        getList() {
            this.loading = true;
            getAdminSellBuyPage(this.queryParams).then(response => {
                this.tagList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
        },
        views(row) {
            this.$refs.logRef.show(row.id)

        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        }
    }
};
</script>
<style lang="scss" scoped>
.info-content {
    font-size: 14px;

    .base-info {
        display: flex;
        flex-wrap: wrap;
        width: 800px;
    }

    .info-item {
        width: 30%;
        flex: 0 0 30%;
        margin-bottom: 15px;

        span {
            font-weight: 600;
        }
    }

    .info-item-row {
        width: 50%;
        flex: 0 0 50%;
        margin-bottom: 15px;

        span {
            font-weight: 600;
        }
    }
}

.other-info {
    display: flex;
    margin-top: 30px;

    .info-table {
        margin-left: 30px;

        &:first-of-type {
            margin-left: 0;
        }
    }
}

.info-title {
    font-size: 18px;
    margin-bottom: 5px;

    &::before {
        content: "";
        display: inline-block;
        width: 3px;
        height: 15px;
        background: #1777FF;
        border-radius: 3px;
        margin-right: 8px;
    }
}
</style>